import { defineStore } from 'pinia'
import {state} from "vue-tsc/out/shared";

export const useCountStore = defineStore('count', {
    //state要写成一个函数 ===真正存数据的地方
    //actions里面放置的是一个一个的方法,用于响应组件中的'动作'
    actions: {
       increment(value:number) {
           console.log('increment被调用',value)
           //修改数据
           console.log(this.sum)
           this.sum += value
       },
    },
    state() {
        return {
            sum: 6,
            age: 12,
        }
    },
    getters: {
        bigSum :state =>  state.sum * 10,
        upperAge() :number {
            return age = 30
        }
    },
})